home *** CD-ROM | disk | FTP | other *** search
- /* **********************************************************************
- * * Copyright (c) IBM Corporation, 1994 *
- * * All Rights Reserved *
- * **********************************************************************
- *
- * IBM System Information Tool Installation
- */
-
- '@echo off'
- trace off
-
- /* Load in function library
- */
- Call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
- Call SysLoadFuncs
-
- /* Parse Call Path Info
- */
- Parse Source . . callPath
-
- /* Strip program name
- */
- rcp = REVERSE(callPath)
- callPathDir = REVERSE(substr(rcp,POS("\",rcp)+1))
-
- /* Create Queue to catch system error messages
- */
- rcode = RXQUEUE('delete', errq)
- errq = RXQUEUE('create')
- new = RXQUEUE('set', errq)
-
- /* Define stem of files to be copied
- */
- MaxCopyIndex = 2
- Files. = ""
- Files.0 = MaxCopyIndex
- Files.1 = "SYSINFO.@"
- Files.2 = "RSPDDI.EXE"
-
- /* Determine bootdrive
- */
- CurDir = DIRECTORY()
- SrcDir = callPathDir
- if (SubStr(SrcDir,Length(SrcDir),1) \= "\") then
- SrcDir = SrcDir||"\"
- PathStr = VALUE("PATH",,"OS2ENVIRONMENT")
- InsPathPos = POS("\OS2\INSTALL",PathStr)
- if (InsPathPos == 0) then
- InsPathPos = POS("\os2\install",PathStr)
- if (InsPathPos \= 0) then
- do
- BootDrive = Substr(PathStr,InsPathPos-2,2)
- InsPath = TRANSLATE(BootDrive||"\OS2\INSTALL")
- end
- else do
- /* \OS2\INSTALL is a required path directory!
- */
- 'helpmsg SYS0010 | RXQUEUE 'errq
- call DumpErrMsg
- call Done
- end
-
- /* Verify Source Files
- */
- do i = 1 to MaxCopyIndex
- rc = VerifySourcePath( SrcDir||Files.i )
- if ( rc == 1 ) then
- call Done
- end
-
- /* Check and Clean Dirty System
- */
- InsDir = DIRECTORY(InsPath)
- if (InsDir == InsPath) then
- do
- CleanDir = InsDir||"\SYSINFO"
- TargetDir = DIRECTORY(CleanDir)
- if (TargetDir == CleanDir) then
- do
- call DeleteFiles CleanDir
- InsDir = DIRECTORY(InsPath)
- rc = SysRmDir(CleanDir)
- if (rc \= 0) then
- do
- 'helpmsg sys'||rc||' | RXQUEUE 'errq
- call DumpErrMsg
- call Done
- end
- end
- end
- else do
- /* \OS2\INSTALL is a required path directory!
- */
- 'helpmsg SYS0010 | RXQUEUE 'errq
- call DumpErrMsg
- call Done
- end
-
- /* Unpack files and run RSPDDI
- */
- tmpDir = DIRECTORY(InsPath)
- if (tmpDir \= "") then
- do
- rc = SysMkDir("SysInfo")
- if (rc \= 0) then
- do
- 'helpmsg sys'||rc||' | RXQUEUE 'errq
- call DumpErrMsg
- call Done
- end
- NewDir = InsDir||"\SYSINFO"
- tmpDir = DIRECTORY(NewDir)
- success = UnpackFiles(SrcDir, tmpDir, 1)
- if (success == 0) then
- do
- /* Run RSPDDI from \OS2\INSTALL or Source Drive
- */
- rc = VerifySourcePath( InsPath||"\"||Files.2 )
- if ( rc == 1 ) then
- SrcDir||Files.2 tmpDir
- else InsPath||"\"||Files.2 tmpDir
- call DeleteFiles tmpDir
- tempDir = DIRECTORY(InsPath)
- rc = SysRmDir(NewDir)
- if (rc \= 0) then
- do
- 'helpmsg sys'||rc||' | RXQUEUE 'errq
- call DumpErrMsg
- call Done
- end
- tmpDir = DIRECTORY(SrcDir)
- call UpdateWPShell BootDrive
- 'helpmsg SYS1716 | RXQUEUE 'errq
- call DumpErrMsg
- end
- end
-
- Done:
- rc = RXQUEUE('delete', errq)
- exit
-
- /* Procedures and Functions
- */
-
- VerifySourcePath: Procedure Expose errq
-
- Parse Arg file;
-
- fExists = Stream(file,'c','query exists')
- if (fExists == "")
- then do
- 'helpmsg SYS002 | RXQUEUE 'errq
- call DumpErrMsg
- return 1
- end
-
- return 0
-
- UnpackFiles: Procedure Expose Files. errq
-
- Parse Arg SrcPath, TargetPath, index;
-
- if (SubStr(SrcPath,Length(SrcPath),1) == "\") then
- unpackstr = SrcPath||Files.index||" "||TargetPath||,
- " /V /F > nul 2>&1"
- else unpackstr = SrcPath||"\"||Files.index||" "||TargetPath||,
- " /V /F > nul 2>&1"
-
- 'unpack 'unpackstr
-
- if (rc \= 0) then
- do
- 'helpmsg sys'||rc||' | RXQUEUE 'errq
- call DumpErrMsg
- return 1
- end
-
- return 0
-
- DumpErrMsg: Procedure
-
- do while(QUEUED() \= 0)
- parse pull line
- if (POS("SYS",line) \= 0) then
- fFound = 1
- if ((line == "") & (fFound = 1)) then
- do
- /* Empty out queue
- */
- do while(QUEUED() \= 0)
- parse pull line
- end
- leave
- end
- if (POS("SYS1716:",line) \= 0) then
- say SubStr(line,POS(":",line)+2)
- else say line
- end
-
- return
-
- DeleteFiles: Procedure Expose errq
-
- Parse Arg dir;
-
- fspec = dir||"\*.*"
- call SysFileTree fspec, 'dellst', 'FO'
- do i = 1 to dellst.0
- rc = SysFileDelete(dellst.i)
- if (rc \= 0) then
- do
- 'helpmsg sys'||rc||' | RXQUEUE 'errq
- call DumpErrMsg
- end
- end
-
- return
-
- UpdateWPShell: Procedure
-
- Parse Arg drv;
-
- /* Create Program Object in the "System Setup" Folder
- */
- pgmpath = drv||'\OS2\APPS\SYSIGUI.EXE'
- classname = 'WPProgram'
- title = 'System Information Tool'
- location = '<WP_CONFIG>'
- setup = 'OBJECTID=<SysInfo>;'||,
- 'EXENAME='||pgmpath||';'||,
- 'PROGTYPE=PM;'
-
- rc = SysCreateObject(classname, title, location, setup, 'f')
-
- /* Open "System Setup" Folder
- */
- object = '<WP_CONFIG>'
- setup = 'OPEN=DEFAULT'
-
- rc = SysSetObjectData(object, setup)
-
- /* Create a shadow of "System Setup" Folder icon on the Desktop.
- * 93447: This approach was removed in favor of openning the
- * "System Setup" Folder.
- */
- /*
- classname = 'WPShadow'
- title = 'System Information Tool'
- location = '<WP_DESKTOP>'
- setup = 'SHADOWID=<SysInfo>'
-
- rc = SysCreateObject(classname, title, location, setup, 'f')
- */
-
- return
-
-